package site.jlopen.controller.modules;

import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import site.jlopen.assets.config.ThreadAuthUser;
import site.jlopen.domain.job.event.KusciaJobResultEvent;
import site.jlopen.entity.BaseResponse;
import site.jlopen.entity.job.TaskResultDataVo;
import site.jlopen.service.BaseService;

@RestController
@RequestMapping("/jobResult")
public class JobResultController extends BaseService {

	@GetMapping("/list")
	public BaseResponse<List<KusciaJobResultEvent>> list(Long projectId, Long flowId) {
		List<KusciaJobResultEvent> list =  resultService.getResultList(ThreadAuthUser.id(), projectId, flowId, null);
		return new BaseResponse<List<KusciaJobResultEvent>>().success("success").setData(list);
	}

	@GetMapping("/loadResultDatas")
	public BaseResponse<List<TaskResultDataVo>> loadResultDatas(Long projectId, Long flowId) {
		List<TaskResultDataVo> list =  resultService.getResultVos(ThreadAuthUser.id(), projectId, flowId, null);
		return new BaseResponse<List<TaskResultDataVo>>().success("success").setData(list);
	}
}
